package com.dm.shop;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;
import org.springframework.scheduling.annotation.EnableAsync;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.annotation.PostConstruct;

//手动添加配置文件
@PropertySource(value = {"classpath:config.properties"}, encoding = "UTF-8",ignoreResourceNotFound = true)
@PropertySource("classpath:application.properties")
@SpringBootApplication
//mapper扫描
@EnableAsync
@MapperScan("com.dm.shop.mapper")
@EnableSwagger2
public class ShopApplication {

    @PostConstruct
    public void init() {

        // 解决netty启动冲突问题
        // see Netty4Utils.setAvailableProcessors()
        System.setProperty("es.set.netty.runtime.available.processors", "false");
    }
    public static void main(String[] args) {

        SpringApplication.run(ShopApplication.class, args);
        System.out.println("http://localhost:8081/api/swagger-ui.html");
        // main中加下面这一句,Es和Redis不能同时启动
        System.setProperty("es.set.netty.runtime.available.processors", "false");
    }
}
